home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
wics.zip
/
PRINTER.H
< prev
next >
Wrap
C/C++ Source or Header
|
1993-03-05
|
7KB
|
210 lines
//==============================================================================================
//
// Windows Interface Construction Set
// Version 1.00
//
// PRINTER.H - Windows Printing Classes
//
// Copyright ⌐ 1993 by Microdyne Development Technologies
// All rights reserved.
//
//==============================================================================================
#ifndef __PRINTER_H
#define __PRINTER_H
#include <owl.h>
#include <objstrm.h>
#include <owldefs.h>
#include <tcollect.h>
#include <static.h>
#include <dlgtmplt.h>
#include <idlg.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <drivinit.h>
#include <string.h>
#ifdef __cplusplus
}
#endif
// TPrinter status codes
#define PSTAT_OK 0
#define PSTAT_INVALIDDEVICE -1 // Device parameters (to set device) invalid
#define PSTAT_UNASSOCIATED -2 // Object not associated with a printer
// TPrintedPage banding flags
#define PFUNC_GRAPHICS 0x01 // Current band only accepts graphics
#define PFUNC_TEXT 0x02 // Current band only accepts text
#define PFUNC_BOTH 0x03 // Current band accepts both text and graphics
typedef WORD (FAR PASCAL *PTDeviceModeFcn)(HWND, HANDLE, LPSTR, LPSTR);
/*------------------------------------------------------------------------------------------*/
/* Classs TPrintedPage */
/*------------------------------------------------------------------------------------------*/
/* */
/* Abstract: */
/* */
/* TPrintedPage represents the physical printed document which is to be sent to a printer */
/* to be printed. TPrintedPage does the rendering of the document onto the printer. For */
/* every document, or document type, a corresponding TPrintedPage class should be created. */
/* */
/*------------------------------------------------------------------------------------------*/
_CLASSDEF(TPrintedPage)
class TPrintedPage : public TStreamable
{
protected:
Pchar Title;
POINT ScreenDpi;
public:
TPrintedPage(Pchar ATitle);
virtual ~TPrintedPage();
virtual void PrintPage(HDC hdc, WORD Page, POINT Size, POINT dpi) {};
virtual BOOL IsNextPage();
virtual Pchar GetTitle() { return Title; }
virtual int GetMaxPage() { return -1; }
private:
virtual const Pchar streamableName() const { return "TPrintedPage"; }
protected:
virtual Pvoid read(Ripstream) { return this; }
virtual void write(Ropstream) {}
virtual int GetPointSize (LOGFONT FAR * lplf);
};
/*------------------------------------------------------------------------------------------*/
/* Class TPrinter */
/*------------------------------------------------------------------------------------------*/
/* */
/* Abstract: */
/* */
/* TPrinter represents the physical printer device. To print a TPrintedPage, send the */
/* TPrintedPage to the TPrinter's Print function. */
/* */
/*------------------------------------------------------------------------------------------*/
_CLASSDEF(TPrinter)
class TPrinter: public TStreamable
{
private:
int Status;
int Error;
HANDLE hDevNames;
HANDLE hDevMode;
HINSTANCE DeviceModule;
PTDeviceModeFcn DeviceMode;
LPFNDEVMODE ExtDeviceMode;
int DevSettingSize;
BOOL fUserAbort;
HDC PrnDC;
WORD Flags;
POINT PageSize;
POINT dpi;
BOOL fBefore31;
virtual const Pchar streamableName() const { return "TPrinter"; }
protected:
virtual Pvoid read(Ripstream) { return this; }
virtual void write(Ropstream) {}
public:
TPrinter();
virtual ~TPrinter();
void ClearDevice();
void Configure(PTWindowsObject Window);
virtual HDC GetDC(PTWindowsObject ParentWin, Rint n, Rint nFromPage, Rint nToPage);
virtual void ReportError(PTWindowsObject ParentWin, PTPrintedPage Printout);
void SetDevice();
BOOL Print(PTWindowsObject ParentWin, PTPrintedPage Printout);
};
/*------------------------------------------------------------------------------------------*/
/* Class TPrinterAbortDlg */
/*------------------------------------------------------------------------------------------*/
/* */
/* Abstract: */
/* */
/* TPrinterAbortDlg represents the "printing" dialog box that is displayed while TPrinter */
/* is printing a TPrintedPage. */
/* */
/*------------------------------------------------------------------------------------------*/
#define ID_TITLE 101
#define ID_DEVICE 102
#define ID_PORT 103
#define ID_PAGEOFPAGE 104
_CLASSDEF(TPrinterAbortDlg)
class TPrinterAbortDlg: public TIndirectDialog
{
private:
BOOL FAR * pfUserAbort;
Pchar ATitle;
LPSTR ADevice;
LPSTR APort;
int MaxPage;
int CurrentPage;
protected:
virtual void WMCommand(RTMessage) = [WM_FIRST + WM_COMMAND];
public:
TPrinterAbortDlg(PTWindowsObject AParent, PTDialogTemplate ADialogTemplate, Pchar Title, LPSTR Device, LPSTR Port, BOOL& fUserAbort);
~TPrinterAbortDlg();
virtual void SetupWindow();
virtual void SetMaxPage (int p);
virtual void SetCurrentPage (int p);
};
/*------------------------------------------------------------------------------------------*/
/* Class TPrinterErrorDlg */
/*------------------------------------------------------------------------------------------*/
/* */
/* Abstract: */
/* */
/* TPrinterErrorDlg represents the "Printer Error" dialog box that is displayed when */
/* TPrinter detects an error. */
/* */
/*------------------------------------------------------------------------------------------*/
_CLASSDEF(TPrinterErrorDlg)
class TPrinterErrorDlg: public TIndirectDialog
{
private:
protected:
public:
TPrinterErrorDlg(PTWindowsObject AParent, PTDialogTemplate ADialogTemplate)
: TIndirectDialog (AParent, ADialogTemplate) {}
~TPrinterErrorDlg() {}
virtual void SetupWindow()
{
TIndirectDialog::SetupWindow();
SendDlgItemMsg (102, STM_SETICON, LoadIcon(NULL, IDI_HAND), 0L);
}
};
#endif